import request from '@/utils/request';

// 获取当前用户信息
export function getCurrentUser() {
  return request({
    url: '/me',
    method: 'get'
  });
}

// 修改密码
export function changePassword(data: { old_password: string, new_password: string }) {
  return request({
    url: '/change-password',
    method: 'post',
    data
  });
}

// 获取用户列表
export function getUserList() {
  return request({
    url: '/users',
    method: 'get'
  });
}

// 创建用户
export function createUser(data: any) {
  return request({
    url: '/users',
    method: 'post',
    data
  });
}

// 更新用户
export function updateUser(id: string, data: any) {
  return request({
    url: `/users/${id}`,
    method: 'put',
    data
  });
}

// 删除用户
export function deleteUser(id: string) {
  return request({
    url: `/users/${id}`,
    method: 'delete'
  });
}